<?php
$prev_post   = get_adjacent_post(false, '', true);
$next_post   = get_adjacent_post(false, '', false);
$cur_post_id = get_the_ID();
$post_meta   = get_post_meta($cur_post_id);
$pTitle      = get_the_title();
$pContent    = get_the_content();
$isEn        = is_en();
$pHeader     = $post_meta['ucc_header_en'][0];
$str_start   = _trans('ucc.starting');

if(!$isEn){
	$pTitle = $post_meta['ucc_title_vi'][0];
}
?>
<div class="row">
	<div class="col-md-9">
		<h3 class="title"><?php echo $pTitle; ?></h3>
	</div>
	<div class="col-md-3">
		<ul class="pager pull-right">
			<?php 
				if($prev_post!='') {
					$prev_meta = get_post_meta($prev_post->ID);
					$prev_post->post_title = $isEn?$prev_post->post_title:$prev_meta['ucc_title_vi'][0];
			?>
			<li><a title="<?php echo $prev_post->post_title; ?>" href="<?php echo url_by_lang($prev_post->ID); ?>"><?php echo _trans('title.prev'); ?></a></li>
			<?php } ?>
			
			<?php 
				if($next_post!='') { 
					$next_meta = get_post_meta($next_post->ID);
					$next_post->post_title = $isEn?$next_post->post_title:$next_meta['ucc_title_vi'][0];
			?>
			<li><a title="<?php echo $next_post->post_title; ?>" href="<?php echo url_by_lang($next_post->ID); ?>"><?php echo _trans('title.next'); ?></a></li>
			<?php } ?>
		</ul>
	</div>
	<div class="clearfix"></div>
</div>

<div class="row">
	<div class="col-md-12 col-xs-12 col-sm-12">
		<?php echo $str_start; ?>&nbsp;
		<strong><?php echo $post_meta['ucc_date'][0]; ?></strong>
	</div>
</div>

<hr/>

<div class="row">
	<div class="col-md-12 col-xs-12 col-sm-12" id="list-upcomming-course">
		<?php 
			$args = array('post_type'=>'up-comming-course','post__not_in'=>array($cur_post_id), 'order'=>'DESC');
			$aPost = query_posts( $args );
		?>
		<h4 class="title">
			<span><?php echo _trans('title.other_u_c_course'); ?></span>
			<span class="badge bgred"><?php echo count($aPost); ?></span>
		</h4>
		<ul>
			<?php 
			while ( have_posts() ) : the_post();
			$meta  = get_post_meta(get_the_ID());
			$title = $isEn?get_the_title() : $meta['ucc_title_vi'][0];	
			?>
			<li>
				<a class="comming-title" title="<?php echo $title; ?>" href="<?php the_permalink(); ?>">
					<i class="glyphicon glyphicon-chevron-right"></i>&nbsp;
					<?php echo $title; ?>
				</a>
				<p class="comming-date">
					<?php echo $str_start; ?> 
					<strong><?php echo $meta['ucc_date'][0]; ?></strong>
				</p>
			</li>
			<?php
			endwhile; 
			wp_reset_query();
			?>
		</ul>	
	</div>
</div>